home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / yerk / mps231ss.hqx / Mops source / Toolbox classes / Window < prev    next >
Text File  |  1993-02-20  |  2KB  |  79 lines

  1. \ Window class.
  2.  
  3. \  May    91 mrh    Added NonScrollWind.
  4. \        Default grow and drag limits set at grow and drag time.
  5. \        Also fixed a number of long-standing bugs in draw:, enable:, disable:
  6. \        etc.  New: deactivates current window.  Added PenIntoWind:.
  7. \  July 91 mrh    Moved Window class into module WindowMod.
  8.  
  9.  
  10.         variable    THEWINDOW
  11.   -1    constant    INFRONT
  12.         variable    THEPORT
  13.  129    constant    THUMB
  14.  
  15.    0    constant    DOCWIND
  16.   16    constant    RNDWIND
  17.    1    constant    DLGWIND
  18.  
  19.    0    value    ACTW        \ Indentifies any active Mops window which
  20.                     \ should be idled.  Will be set zero if we have, say,
  21.                     \ a dialog as the front window, but NOT if we're
  22.                     \ switched into the background.
  23.  
  24.     0    value    SaveActW    \ Saves actW over Suspend-Resume
  25.  
  26. forward    WHRFEV                \ Will become  where: fEvent
  27.  
  28. \ ( val -- )  These next words set text characteristics for current grafPort
  29.  
  30. : TFONT        makeInt  call TextFont  ;
  31. : TFACE        makeInt  call TextFace  ;
  32. : TMODE        makeInt  call TextMode  ;
  33. : TSIZE        makeInt  call TextSize  ;
  34.  
  35. : INITFONT    9 tsize  4 tfont ( Monaco )  0 tMode  0 tFace  ;
  36.  
  37. : TBOOL        \ ( b -- bool )  Makes a Mops boolean into a Toolbox boolean
  38.     $ 100  and  makeint  ;
  39.  
  40. \ Save and restore the GrafPort
  41.  
  42. : SAVEPORT    thePort    call GetPort  ;
  43. : RESTPORT    thePort @  call SetPort  ;
  44.  
  45. \ Utility routines for calculating a scroll bar's position.
  46.  
  47. : >VRECT  { left top rt bot -- l' t' r' b' }
  48.     rt 15 -    top 1-    rt 1+    bot 14 -   ;
  49.  
  50. : >HRECT  { left top rt bot -- l' t' r' b' }
  51.     left 1-    bot 15 -    rt 14 -    bot 1+   ;
  52.  
  53.  
  54. from WindowMod  import{  WINDOW  }
  55.  
  56. compile: windowMod
  57.  
  58. \ NonScrollWind is a window that will not scroll.  This preserves fprect which we
  59. \  may be using for scrolling text somewhere else.
  60.  
  61. :class    NONSCROLLWIND    super{  window  }
  62.  
  63. :m  CLASSINIT:
  64.     classinit: super  false setScroll: self   ;m
  65.  
  66. ;class
  67.  
  68.  
  69. fWind  ' window  set_class
  70. classinit: fWind    markalive: fWind
  71.  
  72.  
  73. true value    fWindActive?    \ Will be true only when fwind is active.
  74.                             \ It it set/reset by enFW and disFW (see
  75.                             \ FEMod.txt).
  76.  
  77.  
  78. true  setinstall: windowMod
  79.